<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    /*
     1、什么是解构赋值：把数组中的元素，字符串中的字符，对象中的属性分解成一个一个的变量
    */
</script>
<script>
    let arr = [10, 20, 30]
    console.log(arr[0]);
    console.log(arr[1]);
    console.log(arr[2]);
    // 1、完全解构
    let [x, y, z] = [10, 20, 30]
    console.log(x, y, z);
    // 2、不完全解构
    // let [m, n, l] = [40, 50]
    // console.log(m, n, l);
    // 3、赋初值
    let [m, n, l = 60] = [40, 50]
    console.log(m, n, l);
    // 4、嵌套
    let [q, w, [e, r, t = 't']] = ['q', 'w', ['e', 'r']]
    console.log(q, w, e, r, t);
</script>

</html>